<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
  <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
  <link rel="stylesheet" media="print" type="text/css" href="./print.css" />

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="dokuwiki export">

<h1 class="sectionedit1"><a name="creating_gschem_symbols_quickly_and_easily_using_tragesym_and_a_spreadsheet_program" id="creating_gschem_symbols_quickly_and_easily_using_tragesym_and_a_spreadsheet_program">Creating gschem symbols quickly and easily using tragesym and a spreadsheet program</a></h1>
<div class="level1">

<p>
Creating symbols for schematic capture can be very time consuming, error prone, and an all around pain. Luckily, gschem uses an open, text based file format that is very easy to use with scripting. This short tutorial describes how to use the tragesym script, to create symbols very quickly (probably more quickly than with any commercial package).
</p>

</div>
<!-- EDIT1 SECTION "Creating gschem symbols quickly and easily using tragesym and a spreadsheet program" [156-604] -->
<h2 class="sectionedit2"><a name="required_steps" id="required_steps">Required Steps</a></h2>
<div class="level2">
<ul>
<li class="level1"><div class="li"> Step1: Open a tragesym template file</div>
</li>
<li class="level1"><div class="li"> Step2: Download the part data sheet and find the pin list</div>
</li>
<li class="level1"><div class="li"> Step3: Copy the pin list into an editor and prepare it</div>
</li>
<li class="level1"><div class="li"> Step4: Insert all missing data into the spreadsheet</div>
</li>
<li class="level1"><div class="li"> Step5: Export the spreadsheet into a tab separated text file</div>
</li>
<li class="level1"><div class="li"> Step6: execute tragesym and create the symbol</div>
</li>
<li class="level1"><div class="li"> Step7: check the result with gschem and do some artwork</div>
</li>
</ul>

</div>
<!-- EDIT2 SECTION "Required Steps" [605-1027] -->
<h2 class="sectionedit3"><a name="step1open_a_tragesym_template_file" id="step1open_a_tragesym_template_file">Step1: Open a tragesym template file</a></h2>
<div class="level2">

<p>
tragesym comes with two template files. One is <a href="media/tragesym/template2.txt.src" class="media mediafile mf_src" title="tragesym:template2.txt.src">ASCII text</a>, the second is a <a href="media/tragesym/template2.ods" class="media mediafile mf_ods" title="tragesym:template2.ods">OpenOffice spreadsheet file</a>. You can obtain them from the gEDA utility package, too (utils/examples/tragesym/template.src and utils/examples/tragesym/template.ods).
 If you prefer a different spreadsheet program, like gnumeric or kspread, just create your own template out of the textual template file. The only difference between the textual template and the spreadsheet template is the syntax of the key value pairs in the [options] and [geda_attr] sections. The textfile splits them with an equal sign (key=value), the spreadsheet has the value in the second column (which becomes a tab after being exported).
</p>

</div>
<!-- EDIT3 SECTION "Step1: Open a tragesym template file" [1028-1826] -->
<h2 class="sectionedit4"><a name="step2download_the_part_data_sheet_and_find_the_pin_list" id="step2download_the_part_data_sheet_and_find_the_pin_list">Step2: Download the part data sheet and find the pin list</a></h2>
<div class="level2">

<p>
For this example, we will create a symbol from the Philips Semiconductor PCA9555 16-bit IIC IO port. The description of product and datasheet is available at Philips:  <a href="http://www-us.semiconductors.philips.com/cgi-bin/pldb/pip/pca9555.html" class="urlextern" title="http://www-us.semiconductors.philips.com/cgi-bin/pldb/pip/pca9555.html"  rel="nofollow">http://www-us.semiconductors.philips.com/cgi-bin/pldb/pip/pca9555.html</a>. Download the datasheet and open it with a pdf viewer that allows copying text out of the pdf file, such as kpdf or acroread. Flip through the pages until you find the pinout for the device:
</p>

<p>
<a href="media/tragesym/kpdf_pinconfiguration.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:kpdf_pinconfiguration.png"><img src="media/tragesym/kpdf_pinconfiguration.png" class="media" alt="" /></a> <a href="media/tragesym/acroread_selectiontable.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:acroread_selectiontable.png"><img src="media/tragesym/acroread_selectiontable.png" class="media" alt="" /></a>
</p>

<p>
Inside the datasheet the pin list may only be in the drawing of the pin configuration. If there’s a nice table, like in the second picture from a different datasheet, use this one.
</p>

</div>
<!-- EDIT4 SECTION "Step2: Download the part data sheet and find the pin list" [1827-2599] -->
<h2 class="sectionedit5"><a name="step3copy_the_pin_list_into_an_editor_and_prepare_it" id="step3copy_the_pin_list_into_an_editor_and_prepare_it">Step3: Copy the pin list into an editor and prepare it</a></h2>
<div class="level2">

<p>
Select the pin list and copy it into a text editor. This intermediate step is required as your spreadsheet program may need a special field separator, like comma or tab. You may have to remove duplicate separators or replace it with tabs.
</p>

<p>
<strong>Note:</strong> The selection behaviour of kpdf is different from the acroread viewer. The kpdf viewer seems to give you a copy that looks more like the graphical representation, while the acroread viewer produces an output that is more “file order” oriented. If you have to create a lot of symbols, try both and compare the results.
</p>

<p>
<a href="media/tragesym/xemacs_rawselection.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:xemacs_rawselection.png"><img src="media/tragesym/xemacs_rawselection.png" class="media" alt="" /></a> <a href="media/tragesym/xemacs_modifiedselection.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:xemacs_modifiedselection.png"><img src="media/tragesym/xemacs_modifiedselection.png" class="media" alt="" /></a> <a href="media/tragesym/ooo_selection.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:ooo_selection.png"><img src="media/tragesym/ooo_selection.png" class="media" alt="" /></a>
</p>

<p>
The pictures above illustrate the steps:
</p>
<ul>
<li class="level1"><div class="li"> insert the selection from your pdf viewer into a text editor</div>
</li>
<li class="level1"><div class="li"> modify the pinlist to make your spreadsheet program happy</div>
<ul>
<li class="level2"><div class="li"> cut out pinlist 24 to 13 with a rectangular selection</div>
</li>
<li class="level2"><div class="li"> insert the rectangular selection below the pins 1 to 12</div>
</li>
<li class="level2"><div class="li"> sort the lines (xemacs can do that <img src="images/smileys/icon_wink.gif" class="middle" alt=";-)" />)</div>
</li>
<li class="level2"><div class="li"> remove or repair the lines with the numbers 2,3,… They are not in the same line. You can easily recreate the pin numbers later</div>
</li>
<li class="level2"><div class="li"> replace the spaces with tabs (not really need when using OpenOffice)</div>
</li>
</ul>
</li>
<li class="level1"><div class="li"> copy the modified data into the spreadsheet template somewhere beside</div>
</li>
</ul>

</div>
<!-- EDIT5 SECTION "Step3: Copy the pin list into an editor and prepare it" [2600-3970] -->
<h2 class="sectionedit6"><a name="step4insert_all_missing_data_into_the_spreadsheet" id="step4insert_all_missing_data_into_the_spreadsheet">Step4: Insert all missing data into the spreadsheet</a></h2>
<div class="level2">

<p>
Now, move the labels into the label column and the pin numbers into the pin number column. You can use the autofill feature of your spreadsheet program to create the pin numbers, too.
</p>

<p>
<a href="media/tragesym/ooo_rearanged.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:ooo_rearanged.png"><img src="media/tragesym/ooo_rearanged.png" class="media" alt="" /></a>
</p>

<p>
Set the type, style and position column to the most common value. You can use the autofill feature again.
</p>

<p>
Now you want to change some of the values. Take a look at the pin description table in the datasheet:
</p>

<p>
<a href="media/tragesym/kpdf_pindescription.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:kpdf_pindescription.png"><img src="media/tragesym/kpdf_pindescription.png" class="media" alt="" /></a>
</p>

<p>
Regarding to that table we change the following things (see result below):
</p>
<ul>
<li class="level1"><div class="li"> Pin 1 is an output, we like to have a negation bubble and a negation overbar</div>
</li>
<li class="level1"><div class="li"> A1 to A3 are inputs, we change the type and move them to the left side</div>
</li>
<li class="level1"><div class="li"> set the SCL type to input and move SCL and SDA to the left side, too</div>
</li>
<li class="level1"><div class="li"> change the type of the power pins VSS and VDD and add net names. We use the more usual GND and Vcc.</div>
</li>
</ul>

<p>
<strong>Note:</strong> If one of your pin labels has a backslash “\” inside, you have to replace it with it&#039;s escape sequence “\\”.
</p>

<p>
<a href="media/tragesym/ooo_changedpins.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:ooo_changedpins.png"><img src="media/tragesym/ooo_changedpins.png" class="media" alt="" /></a>
</p>

<p>
Before going on set the attributes and the options to appropriate values.
</p>

<p>
<a href="media/tragesym/ooo_attributes.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:ooo_attributes.png"><img src="media/tragesym/ooo_attributes.png" class="media" alt="" /></a>
</p>

</div>
<!-- EDIT6 SECTION "Step4: Insert all missing data into the spreadsheet" [3971-5176] -->
<h2 class="sectionedit7"><a name="step5export_the_spreadsheet_into_a_tab_separated_text_file" id="step5export_the_spreadsheet_into_a_tab_separated_text_file">Step5: Export the spreadsheet into a tab separated text file</a></h2>
<div class="level2">

<p>
You can either use the export function of your spreadsheet program to create a tab separated textfile or just select the table and copy the content into your text editor and save the file.
</p>

</div>
<!-- EDIT7 SECTION "Step5: Export the spreadsheet into a tab separated text file" [5177-5440] -->
<h2 class="sectionedit8"><a name="step6execute_tragesym_and_create_the_symbol" id="step6execute_tragesym_and_create_the_symbol">Step6: execute tragesym and create the symbol</a></h2>
<div class="level2">

<p>
Use a shell and execute tragesym:
</p>

<p>
<code>werner@werner-amd64:~/Desktop/tragesym_tutorial&gt; tragesym pca555.src pca555.sch</code>
</p>

<p>
If tragesym says that there&#039;s an error, just make some changes in the spreadsheet and export the file again, or just edit the exported file.
</p>

</div>
<!-- EDIT8 SECTION "Step6: execute tragesym and create the symbol" [5441-5760] -->
<h2 class="sectionedit9"><a name="step7check_the_result_with_gschem_and_do_some_artwork" id="step7check_the_result_with_gschem_and_do_some_artwork">Step7: check the result with gschem and do some artwork</a></h2>
<div class="level2">

<p>
Now open the generated symbol with gschem and check the result
</p>

<p>
<code>werner@werner-amd64:~/Desktop/tragesym_tutorial&gt; gschem pca555.sch</code>
</p>

<p>
Enabling the hidden text (“en”, Edit→Show/Hide Inv Text), you can see the whole generated symbol. It&#039;s not really necessary to change anything, but it might improve the look of the symbol if you rearrange the pins a little bit.
</p>

<p>
<a href="media/tragesym/gschem_showhidden.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:gschem_showhidden.png"><img src="media/tragesym/gschem_showhidden.png" class="media" alt="" /></a> <a href="media/tragesym/gschem_finished.png?id=geda%3Atragesym_tutorial" class="media" title="tragesym:gschem_finished.png"><img src="media/tragesym/gschem_finished.png" class="media" alt="" /></a>
</p>

<p>
Now we have a complete symbol. You can copy the symbol to your local symbol library e.g. /usr/local/share/gEDA/sym/local/ and use it.
</p>

</div>
<!-- EDIT9 SECTION "Step7: check the result with gschem and do some artwork" [5761-6401] -->
<h2 class="sectionedit10"><a name="conclusion" id="conclusion">Conclusion</a></h2>
<div class="level2">

<p>
This was a simple example with a small pincount, but this method really pays off when you have high pin counts (ie, bga-272, tfqp-100, etc).
</p>

</div>
<!-- EDIT10 SECTION "Conclusion" [6402-6566] -->
<h2 class="sectionedit11"><a name="credits" id="credits">Credits</a></h2>
<div class="level2">

<p>
Many thanks to &lt;Russ.Dill(AT)asu.edu&gt;, who wrote the first version of this tutorial.
You can find that tutorial at
<a href="http://www-mdp.eng.cam.ac.uk/web/CD/engapps/geda/geda-doc/tutorials/tragesym/tragesym.html" class="urlextern" title="http://www-mdp.eng.cam.ac.uk/web/CD/engapps/geda/geda-doc/tutorials/tragesym/tragesym.html"  rel="nofollow">http://www-mdp.eng.cam.ac.uk/web/CD/engapps/geda/geda-doc/tutorials/tragesym/tragesym.html</a>
</p>

</div>
<!-- EDIT11 SECTION "Credits" [6567-] --></div>
</body>
</html>
